<div class="bm news">
	<div class="pg_cent">
		<div class="bugpage">
		<%= flash[:notice] %>
	  <% @report.each do |r| %>
			<div class="bug_list">
			<div class="bug_head">
				<h3><%= r.title %></h3>
				<div class="bug_info">
						<span>
            <% if r.ctype == 1 %>已修复
            <% elsif r.ctype == 2 %>已采纳
            <% end %>
            </span>
						<span><%= r.contact %></span>
				</div>
			</div>
				<div class="bug_centent"><%= r.content %></div>
			</div>
      <% end %>
      <div class="page"><%= will_paginate @gonglue %></div>
			<%= form_for :bug, :url => report_path, :html => {:multipart => true, :onsubmit => "verbugform()"} do |f| %>
			<div class="bug_form bug_list">                        	
				<div class="bug_head">
						<h3>游戏建议&BUG提交</h3>
						<div class="bug_info">
						    <span>选择分类:</span>                                        
						    <select name="bug[ctype]" class="colselect" onchange="imgdisplay(this,'.imgfile',1)">
						        <option value="1" selected="selected">游戏BUG</option>
						        <option value="2">游戏建议</option>
						    </select>
						    <span>游戏帐号:</span>
								<%= f.text_field :contact, :class => "usertxt" %>
						</div>
				 </div>
				 <div class="bug_centent">
						<span>信息标题:</span>
						<%= f.text_field :title, :class => "usertxt" %>
						<%= text_area(:bug, :content, :style => "width:100%;height:125px") %>
						<div class="imgfile">有效截图:
							<%= f.file_field :image, :class => "upimg" %>	
						</div>
				 </div>
				 <div class="bug_btns">
						<%= hidden_field(:bug, :status, :value => 0)%>
						<input type="submit" class="bug_btn" value="提交">
				 </div>
				</div>
				<% end %> 
  		</div>                	
  	</div>
  </div>
</div>
<div class="cl"></div>
</div>
</div>
<script type="text/javascript">
function imgdisplay(sl,e,shownum){
    status = 'hide';
    status = $(sl).val() == shownum ? 'show' : 'hide';
    if(status == 'show')
        $(e).removeClass('none') ? $(e).addClass('block') : '';
    if(status == 'hide')													
        $(e).removeClass('block') ? $(e).addClass('none') : '';
    }
function verlength(e){
	  return $(e).val().length ? true : false;	
}
function verbugform(){
	msg = '';
	msg += verlength('.usertxt') ? '' : '*游戏用户名不能为空\r\n';
	msg += verlength('.bugtxt') ? '' : '*BUG内容必须填写\r\n';
	if($('.colselect').val() == 1)
	{
		msg += verlength('.upimg') ? '' : '*BUG有效截图必须\r\n';
	} 
	msg == '' ? '' : alert(msg);
	ret = msg == '' ?  true :  false;
	return ret;
}
</script>
